#include "PlayListener.h"
#include "../GameStates/Play.h"
#include "../SGD Wrappers/SGD_Event.h"
#include "Player.h"

PlayListener::PlayListener () : SGD::Listener(this)
{
	RegisterForEvent("INCREASE_SCORE");
}


PlayListener::~PlayListener ()
{
	UnregisterFromEvent("INCREASE_SCORE");
}

void PlayListener::HandleEvent( const SGD::Event* pEvent)
{
	if(pEvent->GetEventID() == "INCREASE_SCORE")
	{
		int * deleteMe = reinterpret_cast<int *>(pEvent->GetData());
		Play::GetInstance()->GetPlayer()->AddScore((*deleteMe));
		delete deleteMe;
	}
}
